
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>实例属性 - vue.js</title>
        <meta charset="utf-8">
        <meta name="description" content="Vue.js - Intuitive, Fast and Composable MVVM for building interactive interfaces.">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!-- <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600|Source+Code+Pro|Dosis:300,500' rel='stylesheet' type='text/css'> -->
        <link rel="icon" href="/images/logo.png" type="image/x-icon">
        <script>
            window.PAGE_TYPE = "api"
        </script>
        <link rel="stylesheet" href="/css/page.css" type="text/css">
        <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-46852172-1', 'vuejs.org');
  ga('send', 'pageview');
</script>
        <script src="/js/vue.js"></script>
    </head>
    <body>
        <div id="mobile-bar">
            <a class="menu-button"></a>
            <a class="logo" href="/"></a>
        </div>
        
            <div id="header">
    <a id="logo" href="/">
        <img src="/images/logo.png">
        <span>Vue.js</span>
    </a>
    <ul id="nav">
        <li>
  <form id="search-form">
    <input type="text" id="search-query" class="st-default-search-input">
  </form>
</li>
<li><a href="/guide/" class="nav-link">教程</a></li>
<li><a href="/api/" class="nav-link current">API</a></li>
<li><a href="/examples/" class="nav-link">示例</a></li>
<li><a href="/blog/" class="nav-link">Blog</a></li>
<li><a href="https://github.com/yyx990803/vue" target="_blank" class="nav-link">GitHub</a></li>

    </ul>
</div>
            <div id="main">
                
                    
    <div class="sidebar">
    <ul class="main-menu">
        <li>
  <form id="search-form">
    <input type="text" id="search-query" class="st-default-search-input">
  </form>
</li>
<li><a href="/guide/" class="nav-link">教程</a></li>
<li><a href="/api/" class="nav-link current">API</a></li>
<li><a href="/examples/" class="nav-link">示例</a></li>
<li><a href="/blog/" class="nav-link">Blog</a></li>
<li><a href="https://github.com/yyx990803/vue" target="_blank" class="nav-link">GitHub</a></li>

    </ul>
    <div class="list">
        <h2>Api</h2>
        <ul class="menu-root">
            
                <li>
                    <a href="/api/index.html" class="sidebar-link">概述</a>
                </li>
            
                <li>
                    <a href="/api/options.html" class="sidebar-link">组件选项</a>
                </li>
            
                <li>
                    <a href="/api/instance-properties.html" class="sidebar-link current">实例属性</a>
                </li>
            
                <li>
                    <a href="/api/instance-methods.html" class="sidebar-link">实例方法</a>
                </li>
            
                <li>
                    <a href="/api/global-api.html" class="sidebar-link">全局 API</a>
                </li>
            
                <li>
                    <a href="/api/directives.html" class="sidebar-link">指令</a>
                </li>
            
                <li>
                    <a href="/api/filters.html" class="sidebar-link">过滤器</a>
                </li>
            
                <li>
                    <a href="/api/elements.html" class="sidebar-link new">特殊元素</a>
                </li>
            
            <li><a href="http://legacy.vuejs.org">旧版 0.11 文档</a></li>
            <li style="margin:10px 0 3px">
              <script data-gittip-username="yyx990803"
                data-gittip-widget="button"
                src="//gttp.co/v1.js"></script>
            </li>
        </ul>
    </div>
</div>


<div class="content api with-sidebar">
    <h1>实例属性</h1>
    <div id="ad">
        <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=vuejs" id="_carbonads_js"></script>
    </div>
    <h3 id="vm-$el">vm.$el</h3><ul>
<li><strong>Type:</strong> <code>HTMLElement</code></li>
<li><strong>只读</strong></li>
</ul>
<p>返回当前 Vue 实例正在管理的 DOM 元素。注意对于<a href="/guide/best-practices.html#片段实例">片段实例</a>，<code>vm.$el</code> 指向的是一个代表片段起始位置的锚节点。</p>
<h3 id="vm-$data">vm.$data</h3><ul>
<li><strong>Type:</strong> <code>Object</code></li>
</ul>
<p>返回当前 Vue 实例正在监视的数据对象 (data object)。你可以用新的对象去替换它。Vue 实例会代理其 $data 对象上的所有属性。</p>
<h3 id="vm-$options">vm.$options</h3><ul>
<li><strong>Type:</strong> <code>Object</code></li>
</ul>
<p>返回当前 Vue 实例所使用的实例化选项。如果你想要调用自定义选项，就会需要用到这个属性:</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">new</span> Vue(&#123;</span><br><span class="line">  customOption: <span class="string">'foo'</span>,</span><br><span class="line">  created: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="keyword">this</span>.$options.customOption) <span class="comment">// -&gt; 'foo'</span></span><br><span class="line">  &#125;</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<h3 id="vm-$parent">vm.$parent</h3><ul>
<li><strong>Type:</strong> <code>Vue</code></li>
<li><strong>只读</strong></li>
</ul>
<p>返回当前 vm 的父实例（如果存在的话）。</p>
<h3 id="vm-$root">vm.$root</h3><ul>
<li><strong>Type:</strong> <code>Vue</code></li>
<li><strong>只读</strong></li>
</ul>
<p>返回当前组件树的根 Vue 实例。如果当前实例已经没有父实例的话将会返回它自己。</p>
<h3 id="vm-$children">vm.$children</h3><ul>
<li><strong>Type:</strong> <code>Array&lt;Vue&gt;</code></li>
<li><strong>只读</strong></li>
</ul>
<p>返回当前实例的直接子实例数组。</p>
<h3 id="vm-$">vm.$</h3><ul>
<li><strong>Type:</strong> <code>Object</code></li>
<li><strong>只读</strong></li>
</ul>
<p>返回一个对象，这个对象包含通过 <code>v-ref</code> 指令注册的子组件。更多细节请查看 <a href="../api/directives.html#v-ref">v-ref</a>。</p>
<h3 id="vm-$$">vm.$$</h3><ul>
<li><strong>Type:</strong> <code>Object</code></li>
<li><strong>Read only</strong></li>
</ul>
<p>返回一个对象，这个对象包含通过 <code>v-el</code> 指令注册的 DOM 元素。更多细节请查看 <a href="../api/directives.html#v-el">v-el</a>。</p>
<h3 id="元属性">元属性</h3><p>被 <code>v-repeat</code> 创建出来的实例也会拥有一些元属性 (Meta properties)。例如 <code>vm.$index</code>, <code>vm.$key</code> 和 <code>vm.$value</code> 等。更多细节请查看教程中的 <a href="../guide/list.html">列表渲染</a> 章节。</p>

    <div class="footer">发现了问题或想要贡献？来 Github 给 Vue.js <a href="https://github.com/vuejs/vuejs.org" target="_blank">英文站点</a>或<a href="https://github.com/Jinjiang/vuejs.org/tree/lang-zh" target="_blank">中文翻译</a>来个 Fork 吧！</div>
</div>
                
            </div>
            <script src="/js/smooth-scroll.min.js"></script>
            <script src="/js/common.js"></script>
        

        <script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script><script src="https://cdn.jsdelivr.net/gh/shentao/vuejs-outdated-docs-modal@v1.3/prompt.min.js"></script>
        <script>
            document.addEventListener('DOMContentLoaded', function() {
                FastClick.attach(document.body);
            }, false);
        </script>
    </body>
</html>
